/* ----- tsr.c ----- */

#include <dos.h>
#include <stdio.h>
#include <string.h>
#include <bios.h>
#include "tsr.h"

void Msg_start(void);
void Msg_resid(void);
void Msg_restr(void);

static union REGS rg;
static struct SREGS sg;
extern char signature[];               /* tsr signature */

/* ------- main function for the TSR program ------ */
main()
{
   int r;

   if ((r = resident(signature))==0  ){
      /* -- tsr is resident -- */
      Msg_start();
      openfiles();
      resinit();
   }
   r==1?Msg_resid():Msg_restr();
}

int get_char()
{
   int c;
   while (keyhit()==0)
      ;
   c=bioskey(0);
   return ((c&0xff)==0)?(((c>>8)&0xff)|128):(c&0xff);
}




